<?php

class HuishengRedis
{
    private $redis;
    public function __construct($config)
    {
        $this->redis = new Redis();
        $this->redis->connect($config['db_host'], $config['db_port']);
    }

    public function uploadFilePop()
    {
        $data = $this->redis->rPop('UploadFiles');
        return $data;
    }

    public function uploadFileLength()
    {
        $length = $this->redis->lLen('UploadFiles');
        return $length;
    }

    public function rPop($queue)
    {
        $data = $this->redis->rPop($queue);
        return $data;
    }

    //推入非实时转写队列
    public function offTransPush($arr)
    {
        $this->redis->lPush('offQueue', json_encode($arr));
        //$this->redis->lPush('roleQueue', json_encode($arr));
        return;
    }
}
